package com.ItemsRent.IService.service;

import java.util.List;

import com.ItemsRent.IDao.dao.BaseDAO;
import com.ItemsRent.IService.IUser;
import com.ItemsRent.model.User;

public class UserImpl implements IUser{

	private BaseDAO<User> userDao; 

	public BaseDAO<User> getUserDao() {
		return userDao;
	}

	public void setUserDao(BaseDAO<User> userDao) {
		this.userDao = userDao;
	}
	
	public void insert(User user){
		userDao.save(user);  
	}
	
	public void delete(User user){
		userDao.delete(user);
	}
	
	public void update(User user){
		userDao.update(user);
	}
	
	public User findById(int id){
		User user;
		user = userDao.find(User.class, id);
		return user;
	}
	
	public List<User> findAll(){
		String hql = "from User";
		List<User> list = userDao.list(hql);
		return list;
	}
}
